﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM
{
    public class DocumentFragment : Node
    {
        #region Constructors

        internal DocumentFragment(Document doc)
            : base(doc)
        {
        }

        #endregion

        #region DOM Level 1 Compliance

        /// <summary>
        /// Creates a copy of this fragment.
        /// </summary>
        /// <param name="deep"></param>
        /// <returns></returns>
        public override Node cloneNode(bool deep)
        {
            DocumentFragment f = new DocumentFragment(Owner);

            if (deep)
            {
                foreach(Node n in Children)
                    f.Children.Add(n.cloneNode(deep));
            }
            return f;
        }

        public override string nodeName
        {
            get { return "#document-fragment"; }
        }

        public override string nodeValue
        {
            get { return null; }
        }

        public override byte nodeType
        {
            get { return DOCUMENT_FRAGMENT_NODE; }
        }

        #endregion
    }
}
